package vn.edu.uit.service;

import java.util.Map;

/**
 * create a object pair key and value
 * in this project support set cookie paramter.
 *
 * @param <K> the key type
 * @param <V> the value type
 * @author HaiGiang
 */
final public class UITMapEntry <K, V> implements Map.Entry<K, V> {
    
    /** key property. */
    private final K mKey;
    
    /** value property. */
    private V mValue;

    /**
     * Constructor MapEntry.
     *
     * @param key the key
     * @param value the value
     */
    public UITMapEntry(K key, V value) {
        this.mKey = key;
        this.mValue = value;
    }

    /* (non-Javadoc)
     * @see java.util.Map.Entry#getKey()
     */
    @Override
    public K getKey() {
        return mKey;
    }

    /* (non-Javadoc)
     * @see java.util.Map.Entry#getValue()
     */
    @Override
    public V getValue() {
        return mValue;
    }

    /* (non-Javadoc)
     * @see java.util.Map.Entry#setValue(java.lang.Object)
     */
    @Override
    public V setValue(V value) {
        V old = this.mValue;
        this.mValue = value;
        return old;
    }

    /* (non-Javadoc)
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {    
        return mKey + "=" + mValue;
    }

}
